<template>
  <div style="width: 100%;height: 500px">
    <h3>欢迎：{{username}}</h3>
    <button @click="logout">退出登录</button>
    <div style="width: 15%;" class="d">
      <router-link to="/main/emp">员工管理</router-link><br/>
      <router-link to="/main/dept">部门管理</router-link><br/>
    </div>
    <div style="width: 79%" class="d">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
  export default {
    name: "Main",
    data(){
      return{
        username: localStorage.getItem("username")
      }
    },
    methods:{
      logout(){
        this.$router.replace("/");
        sessionStorage.clear();
        localStorage.clear(); //
      }
    }
  }
</script>

<style scoped>
 .d{
   border: 1px solid blue;
   float: left;
   height: 100%;
 }
</style>
